package com.api.pay.exception;

import com.alipay.api.AlipayApiException;
import com.api.apicommon.response.BaseResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class AlipayExceptionHandler {

    @ExceptionHandler
    public BaseResponse alipayExceptionHandler(AlipayApiException e) {
        log.error("alipayExceptionHandler", e);
        return new BaseResponse<>(50000, e.getMessage(), null);
    }
}
